From: robertl Date: Fri, 27 Aug 2010 16:04:07 +0000 (+0000) Subject: Various warning fixes and one code gen problem to successfully build with clang. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~16^2~13 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=17e48f09268fcf2a3054f8e1131303767c826cdc;p=gpsbabel.git Various warning fixes and one code gen problem to successfully build with clang. --- diff --git a/csv_util.c b/csv_util.c index 4b9cfb97e..626066b67 100644 --- a/csv_util.c +++ b/csv_util.c @@ -136,6 +136,10 @@ typedef enum { XT_YYYYMMDD_TIME } xcsv_token; +// Static definition of in_word_set to meet C99 rules as used by Clang. +static struct xt_mapping * +in_word_set (register const char *str, register unsigned int len); + #include "xcsv_tokens.gperf" /****************************************************************************/ @@ -704,7 +708,7 @@ xcsv_file_init(void) */ xcsv_file.type = ff_type_file; - xcsv_file.mkshort_handle = (struct short_handle_*) mkshort_new_handle(); + xcsv_file.mkshort_handle = (struct short_handle *) mkshort_new_handle(); xcsv_file.gps_datum = GPS_DATUM_WGS84; } diff --git a/geoniche.c b/geoniche.c index a0992148b..65f84a9ea 100644 --- a/geoniche.c +++ b/geoniche.c @@ -604,6 +604,7 @@ wpt2icon(const waypoint *wpt) case gt_benchmark: return 0; case gt_ape: return 0; case gt_mega: return 0; + case gt_wherigo: return 0; } return 0; diff --git a/itracku.c b/itracku.c index d23d91696..ee23585db 100644 --- a/itracku.c +++ b/itracku.c @@ -191,33 +191,36 @@ itracku_device_update_data_read(void* buf, int len) 49 degrees 34.7687 minutes */ +// The argument is marked 'volatile' because of an issue in Apple's v1.5 clang. +// Without this, the sign of 'x' mysteriously changes while in the function. +// adding a printf inside branches not taken changes the behaviour. Very +// mysterious, but not worth tracking down at this time. When xcode 4 comes +// along (or anyone really cares about mega performance of this fairly obscure +// target, we should revisit this. double -deg_min_to_deg(gbuint32 x) +deg_min_to_deg(volatile gbuint32 x) { double sign; - gbuint32 sep; - gbuint32 d; - gbuint32 m10000; - + gbuint32 sep; + gbuint32 d; + gbuint32 m10000; // determine the sign - if (x > 0x80000000) { + if (x > 0x80000000) { sign = -1.0; x -= 0x80000000; - } - else { + } else { sign = 1.0; } sep = 1000000; - // extract degrees - d = x / sep; - - // extract (minutes * 10000) + // extract degrees + d = (unsigned int) x / (unsigned int) sep; + // extract (minutes * 10000) m10000 = x - d * sep; // convert minutes and degrees to a double - return sign * ((double)d + ((double)m10000) / 600000.0); + return sign * ((double)d + ((double)m10000) / 600000.0); } /* @@ -493,6 +496,7 @@ static int import_data_record(itracku_data_record* d) { int result = 0; + if (!itracku_is_valid_data_record(d)) { result = 0; } diff --git a/mac/libusb/darwin.c b/mac/libusb/darwin.c index 08b39a4e5..d550fa6b1 100644 --- a/mac/libusb/darwin.c +++ b/mac/libusb/darwin.c @@ -248,7 +248,8 @@ static usb_device_t **usb_get_next_device (io_iterator_t deviceIterator, UInt32 io_cf_plugin_ref_t *plugInInterface = NULL; usb_device_t **device; io_service_t usbDevice; - long result, score; + long result; + SInt32 score; if (!IOIteratorIsValid (deviceIterator) || !(usbDevice = IOIteratorNext(deviceIterator))) return NULL; @@ -448,7 +449,7 @@ static int claim_interface (usb_dev_handle *dev, int interface) IOUSBFindInterfaceRequest request; struct darwin_dev_handle *device; - long score; + SInt32 score; int current_interface; device = dev->impl_info; @@ -1114,7 +1115,7 @@ int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices) result = (*(device))->GetDeviceAddress(device, (USBDeviceAddress *)&address); if (usb_debug >= 2) - fprintf(stderr, "usb_os_find_devices: Found USB device at location 0x%08lx\n", location); + fprintf(stderr, "usb_os_find_devices: Found USB device at location 0x%08x\n", location); /* first byte of location appears to be associated with the device's bus */ if (location >> 24 == bus_loc >> 24) { @@ -1141,7 +1142,7 @@ int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices) LIST_ADD(fdev, dev); if (usb_debug >= 2) - fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 0x%08lx\n", + fprintf(stderr, "usb_os_find_devices: Found %s on %s at location 0x%08x\n", dev->filename, bus->dirname, location); } diff --git a/mmo.c b/mmo.c index 6562d7b81..c8d1b4330 100644 --- a/mmo.c +++ b/mmo.c @@ -149,7 +149,7 @@ dbgprintf(const char *sobj, const char *fmt, ...) # define DBG(args) dbgprintf args #else -# define DBG(args) ; +# define DBG(args) do {} while (0) ; #endif static char * diff --git a/nmea.c b/nmea.c index 2f0276f74..df3da62bd 100644 --- a/nmea.c +++ b/nmea.c @@ -331,7 +331,7 @@ nmea_wr_init(const char *portname) } } - mkshort_handle = (struct short_handle_*) mkshort_new_handle(); + mkshort_handle = (struct short_handle*) mkshort_new_handle(); setshort_length(mkshort_handle, atoi(snlenopt)); if (opt_gisteq) { diff --git a/tef_xml.c b/tef_xml.c index 70d9d0dfd..8d2d82d20 100644 --- a/tef_xml.c +++ b/tef_xml.c @@ -249,7 +249,7 @@ tef_item_start(const char *args, const char **attrv) else if (0 == case_ignore_strcmp(avp[0], "Altitude")) wpt_tmp->altitude = atof(avp[1]); else if (0 == case_ignore_strcmp(avp[0], "TimeStamp")) - /* nothing for the moment */; + { /* nothing for the moment */ } avp+=2; } diff --git a/xcsv_tokens.gperf b/xcsv_tokens.gperf index a525f4a0c..9fc27f1ce 100644 --- a/xcsv_tokens.gperf +++ b/xcsv_tokens.gperf @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.1 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -L ANSI-C -D -t xcsv_tokens.in */ /* Computed positions: -k'2,4-5,12,$' */ @@ -107,6 +107,9 @@ hash (register const char *str, register unsigned int len) #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) +#endif #endif struct xt_mapping * in_word_set (register const char *str, register unsigned int len)